package com.xiaochun.jiankangapp.viewmodel

import androidx.lifecycle.ViewModel
import com.google.gson.reflect.TypeToken
import com.xiaochun.jiankangapp.model.ReportModel
import com.xiaochun.jiankangapp.model.Response
import com.xiaochun.jiankangapp.network.Request

class SendReportViewModel : ViewModel() {


    suspend fun save(str: String?, name: String): Response<ReportModel> {
        return Request.postSuspend<ReportModel>(
            "api/report/add",
            mapOf("content" to str, "name" to name)
        )
    }

   suspend fun getList() :Response<List<ReportModel>>{
       return Request.postSuspend<List<ReportModel>>(
           "api/report/details",
           type = object : TypeToken<List<ReportModel>>() {}.type
       )
   }
}